using System;
using System.Diagnostics;
using System.Linq;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Microsoft.VisualStudio.Project;
using Microsoft.VisualStudio.Project.Automation;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using VSConstants = Microsoft.VisualStudio.VSConstants;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.OLE.Interop;
using NuGet.Enterprise.Package.Properties;

namespace NuGet.Enterprise.Package
{
    /// <summary>
    /// The Python Project
    /// </summary>
    [Guid(AssemblyGuids.PackageProjectNodeGuidString)]
    public sealed class PackageProjectNode : ProjectNode
    {
        private readonly PackageProjectPackage _package;

        /// <summary>
        /// Initializes a new instance of the <see cref="PackageProjectNode"/> class.
        /// </summary>
        /// <param name="package">The package.</param>
        public PackageProjectNode(PackageProjectPackage package)
        {
            _package = package;
        }

        /// <summary>
        /// Gets the project GUID.
        /// </summary>
        public override Guid ProjectGuid
        {
            get { return AssemblyGuids.PackageProjectFactoryGuid; }
        }

        /// <summary>
        /// Gets the type of the project.
        /// </summary>
        /// <value>
        /// The type of the project.
        /// </value>
        public override string ProjectType
        {
            get { return "NuGetPackageType"; }
        }

        /// <summary>
        /// Creates the folder nodes.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns></returns>
        public override HierarchyNode CreateFolderNodes(string path)
        {
            var fullpath = Path.Combine(this.ProjectFolder, path);

            Directory.CreateDirectory(fullpath);

            return base.CreateFolderNodes(path);
        }

        /// <summary>
        /// Adds the file from template.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="target">The target.</param>
        public override void AddFileFromTemplate(
            string source, string target)
        {
            FileTemplateProcessor.UntokenFile(source, target);

            FileTemplateProcessor.Reset();
        }

    }
}
